<?php
/**
 * @author Tuong Tran <tuong.tran@outlook.com>
 */
class EmailLogger implements IObserver{
    public function notify(\IObservable $objectSource, $eventType) {
        if($objectSource instanceof User){
            switch ($eventType){
                case User::EVENT_UPDATE :
                    $this->_sendMailUpdate($objectSource);
                    break;
                default :
                    break;

            }
        }
    }

    /**
     * send mail to user after user change something
     * @param User $user
     */
    private function _sendMailUpdate(User $user){
        //do something here
    }
}